package com.usooft.metaTalent.db.wx;

import com.usooft.framework.core.query.Page;
import com.usooft.framework.web.auth.RequiresPermission;
import com.usooft.metaTalent.core.wx.service.WxOpenUserService;
import com.usooft.metaTalent.core.wx.wrapper.WxOpenUserWrapper;
import com.usooft.metaTalent.db.wx.form.WxOpenUserListForm;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/wx/wx-open-user")
@RequiredArgsConstructor
public class WxOpenUserController {
    private final WxOpenUserService wxOpenUserService;

    @GetMapping("/list")
    @RequiresPermission(
            value = "/wx/wx-open-user/list",
            description = "微信开放平台用户/查询"
    )
    public ResponseEntity<?> list(WxOpenUserListForm form) {
        Page<WxOpenUserWrapper> page = wxOpenUserService.page(form.buildQuery());
        return ResponseEntity.ok(page);
    }
}
